package com.neusoft.ysu.his.service.impl;

import com.neusoft.ysu.his.entity.CommonResult;
import com.neusoft.ysu.his.entity.Dept;
import com.neusoft.ysu.his.entity.Sch;
import com.neusoft.ysu.his.mapper.SchMapper;
import com.neusoft.ysu.his.service.ISchService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者：赵子鉴
 * @since 2023-09-01
 */
@Service
public class SchServiceImpl  implements ISchService {
    @Autowired
    SchMapper schMapper;
    @Override
    public CommonResult findAll() {
        return new CommonResult<>(schMapper.selectList(null));
    }

    @Override
    public CommonResult findById(int id) {
        return new CommonResult<>(schMapper.selectById(id));
    }

    @Override
    public CommonResult insert(Sch sch) {
        int i=schMapper.insert(sch);
        return new CommonResult<>(i);
    }

    @Override
    public CommonResult updateById(Sch sch) {
        System.out.println("数据库更新："+sch);
        return new CommonResult<>(schMapper.updateById(sch));
    }

    @Override
    public CommonResult deleteById(Sch sch) {

        return new CommonResult<>(schMapper.updateById(sch));
    }
//
//    @Override
//    public CommonResult insert(Sch dept) {
//
//        int i=schMapper.insert(dept);
//        System.out.println(dept.getId());
//        dept.setDeptCode(Integer.toString(dept.getId()));
//        deptMapper.updateById(dept);
//        return new CommonResult<>(i);
//    }
//
//    @Override
//    public CommonResult updateByCode(Dept dept) {
//        System.out.println("数据库更新："+dept);
//        return new CommonResult<>(deptMapper.updateByCode(dept));
//    }
//
//    @Override
//    public CommonResult deleteByDeptCode(Dept dept) {
//
//        return new CommonResult<>(deptMapper.deleteByregnum(dept));
//    }
}
